import { DOUBLE_STATUS } from '@/enum/common';
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
import { BaseEntity } from './base.entity';
import { DictionaryWords } from './dictionary-words.entity';

/**
 * 词汇表
 */
@Entity('dictionary_collection')
export class DictionaryCollection extends BaseEntity {
  @PrimaryGeneratedColumn({
    type: 'int',
    name: 'id',
    comment: '主键，自增',
  })
  id: number;

  @Column({
    type: 'int',
    name: 'word_id',
    comment: `收藏的单词`,
  })
  wordId: number;

  wordInfo: DictionaryWords;

  @Column({
    type: 'int',
    name: 'user_id',
    comment: `收藏的用户id`,
  })
  userId: number;

  @Column({
    type: 'text',
    name: 'dictionary_id',
    comment: `词典id`,
  })
  dictionaryId: number;

  @Column({
    type: 'int',
    name: 'status',
    comment: `
      收藏状态
      1 表示已收藏
      2 表示未收藏
    `,
    default: DOUBLE_STATUS.UN_NORMAL,
  })
  status: DOUBLE_STATUS;
}
